home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2007 January
/
PCWorld_2007-01_cd.bin
/
v cisle
/
autoit
/
autoit-v3.2.0.1-setup.exe
/
Examples
/
Helpfile
/
StringRegExp.au3
< prev
next >
Wrap
Text File
|
2006-06-17
|
1KB
|
33 lines
Local $sPattern, $sTest, $vResult, $nFlag
$sPattern = InputBox("StringRegExp Sample", "What is the pattern to test?")
$sTest = InputBox("StringRegExp Sample", "What is the line to test?")
$vResult = StringRegExp($sTest, $sPattern)
Select
Case @Error = 2
; Error. The pattern was invalid. $vResult = position in $sPattern where error occurred.
Case @Error = 0
if @Extended Then
; Success. Pattern matched. $vResult matches @Extended
Else
; Failure. Pattern not matched. $vResult = ""
EndIf
EndSelect
$sPattern = InputBox("StringRegExp Sample", "What is the pattern to test?")
$sTest = InputBox("StringRegExp Sample", "What is the line to test?")
$nFlag = InputBox("StringRegExp Sample", "What flag to use? 0 - true/false, 1 - single pattern array return, 3 - global pattern array return")
$vResult = StringRegExp($sTest, $sPattern, $nFlag)
Select
Case @Error = 1
; Error. Flag is bad. $vResult = ""
Case @Error = 2
; Error. The pattern was invalid. $vResult = position in $sPattern where error occurred.
Case @Error = 0
if @Extended Then
; Success. Pattern matched. $vResult has the text from the groups or true (1), depending on flag.
Else
; Failure. Pattern not matched. $vResult = "" or false (0), depending on flag.
EndIf
EndSelect